#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>

using namespace std;

const int N=55;

int a[N],b[N],aa[N],bb[N];
vector<int> sta;

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		sta.clear();
		memset(a,0,sizeof a);
		memset(b,0,sizeof a);
		memset(aa,0,sizeof aa);
		memset(bb,0,sizeof bb);
		int n;
		scanf("%d",&n);
		sta.push_back(-1e9-10);
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			sta.push_back(a[i]);
		}
		
		sort(sta.begin()+1,sta.end());
		
//		for(int i=1;i<=n;i++) printf("%d   %d\n",a[i],sta[i]);
		int res=0;
		while(sta.size()>2)
		{
			if(sta[n] == a[n])
			{
				sta.pop_back();
				n--;
				continue;
			}
			memcpy(b,a,sizeof a);
			//for(int i=1;i<=n;i++) printf("%d   %d\n",a[i],b[i]);
			for(int i=n;i>=1;i--)
			{
				if(sta[n] == a[i])
				{
					//printf("%d %d 1\n",i,n);
					res++;
					aa[res]=i,bb[res]=n;
					a[n]=a[i];
					for(int j=i;j<n;j++) a[j]=b[j+1];
					n--;
					sta.pop_back();
					break;
				}
			}
		}
		printf("%d\n",res);
		for(int i=1;i<=res;i++) printf("%d %d 1\n",aa[i],bb[i]);
	}
	return 0;
}
